extends PlayerState

# ===============================================

const DURATION: float = 0.2
const GROUND_FRICTION := 250

# ===============================================

func enter() -> void:
	player.animation_player.play("tackle")


func process(delta: float) -> void:
	if player.velocity == Vector2.ZERO:
		get_tree().create_timer(DURATION).timeout.connect(
			func(): 
				state_transition.emit(self, State.RECOVER)
		)
	else:
		player.velocity = player.velocity.move_toward(Vector2.ZERO, delta * GROUND_FRICTION)
